package com.ltmonitor.service.impl;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ltmonitor.dao.IJT809Command_sanBaoDao;
import com.ltmonitor.entity.JT809Command_sanBao;
import com.ltmonitor.service.IJT809Command_sanBaoService;
import com.ltmonitor.util.DateUtil;

@Service("jt809Command_sanBaoService")
public class JT809Command_sanBaoService extends BaseService<Long, JT809Command_sanBao> implements IJT809Command_sanBaoService{

	@Autowired
	private IJT809Command_sanBaoDao jt809Command_sanBaoDao;
	
	@Override
	public List<JT809Command_sanBao> getLatestCommand() {
		// TODO Auto-generated method stub
		String hsql = "from JT809Command_sanBao where CreateDate > ? and Status = ? and UserId > 0";
		Date startTime = DateUtil.getDate(DateUtil.now(), Calendar.MINUTE, -5);
		List<JT809Command_sanBao> result = this.jt809Command_sanBaoDao.query(hsql,
				new Object[] { startTime, JT809Command_sanBao.STATUS_NEW });

		return result;
	}

}
